import express from 'express';
let router = express.Router();
<% if (checkArgs) { %>import { checkArgs } from '../middleware';<% } %>
import <%= name %>Service from '../../service/<%= baseUrl %>/<%= name %>';
import { packResBody } from '../result';

router.<%= method %>('/', <% if (checkArgs) { %>checkArgs('<%= name %>'), <% } %>async (req, res, next) => {
  try {
    const data = await <%= name %>Service(<% args.forEach(function(arg){ %>
      <%= arg %><% }); %>
    );
    res.send(packResBody(data));
  } catch (error) {
    next(error); // 返回统一异常处理
  }
});

export default router;
